package com.blockmeta.bbs.immodule.net.pojo;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.blockmeta.bbs.immodule.bean.beaninterface.IFriendsEntry;
import com.google.gson.annotations.SerializedName;

/**
 * @author AirThor
 * @date 2019/3/27.
 */
public class CircleMemberResponse implements IFriendsEntry, Parcelable {

    /**
     * chat_group_id : 21
     * id : 25
     * logo : http://bbt8.8btc.com/uc_server/data/avatar/000/25/14/83_avatar_middle.jpg
     * no_disturbing : false
     * remark_name : AirThor
     * name: airThor
     * shield : false
     * user_id : 251483
     */

    @SerializedName("chat_group_id")
    public long chatGroupId;
    @SerializedName("id")
    public int id;
    @SerializedName("logo")
    public String logo;
    @SerializedName("no_disturbing")
    public boolean noDisturbing;
    @SerializedName("remark_name")
    public String remarkName;
    @SerializedName("name")
    public String name;
    @SerializedName("shield")
    public boolean shield;
    @SerializedName("user_id")
    public long userId;
    @SerializedName("group_id")
    public int grade;
    @SerializedName("group_name")
    public String gradeTag;
    @SerializedName("date")
    public String registrationTime;

    private String letter;

    private boolean checkedState;

    protected CircleMemberResponse(Parcel in) {
        chatGroupId = in.readLong();
        id = in.readInt();
        logo = in.readString();
        noDisturbing = in.readByte() != 0;
        remarkName = in.readString();
        name = in.readString();
        shield = in.readByte() != 0;
        userId = in.readLong();
        grade = in.readInt();
        gradeTag = in.readString();
        registrationTime = in.readString();
        letter = in.readString();
        checkedState = in.readByte() != 0;
    }

    public static final Creator<CircleMemberResponse> CREATOR = new Creator<CircleMemberResponse>() {
        @Override
        public CircleMemberResponse createFromParcel(Parcel in) {
            return new CircleMemberResponse(in);
        }

        @Override
        public CircleMemberResponse[] newArray(int size) {
            return new CircleMemberResponse[size];
        }
    };

    @Override
    public String getLetter() {
        return letter;
    }

    @Override
    public String getAvatar() {
        return logo;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getRemarkName() {
        return remarkName;
    }

    @Override
    public int getGrade() {
        return grade;
    }


    @Override
    public String getGradeTag() {
        return gradeTag;
    }

    @Override
    public String getRegistrationTime() {
        return TextUtils.isEmpty(registrationTime)?"0":registrationTime;
    }

    @Override
    public boolean getCheckedState() {
        return checkedState;
    }

    @Override
    public void setCheckedState(boolean checked) {
        this.checkedState = checked;
    }

    @Override
    public long getUserId() {
        return userId;
    }

    public void setLetter(String letter) {
        this.letter = letter;
    }

    @Override
    public long getChatGroupId() {
        return chatGroupId;
    }

    public void setChatGroupId(long chatGroupId) {
        this.chatGroupId = chatGroupId;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

        dest.writeLong(chatGroupId);
        dest.writeInt(id);
        dest.writeString(logo);
        dest.writeByte((byte) (noDisturbing ? 1 : 0));
        dest.writeString(remarkName);
        dest.writeString(name);
        dest.writeByte((byte) (shield ? 1 : 0));
        dest.writeLong(userId);
        dest.writeInt(grade);
        dest.writeString(gradeTag);
        dest.writeString(registrationTime);
        dest.writeString(letter);
        dest.writeByte((byte) (checkedState ? 1 : 0));
    }


    public CircleMemberResponse() {
    }




}
